

#include "integer.h"
#include "fattime.h"
#include "stdint.h"
#include "app.h"

DWORD get_fattime (void)
{
	uint8_t  y, m, d, h, min, s;
	uint32_t tm;
	
	tm = AppInfo.NowTime;
	y = (tm >> 26) + 20;
	m = (tm >> 22) & 0x0f;
	d = (tm >> 17) & 0x1f;
	h = (tm >> 12) & 0x1f;
	min = (tm >> 6) & 0x3f;
	s = (tm & 0x3f) >> 1;
	
	tm = ((uint32_t)y << 25) + ((uint32_t)m << 21) + ((uint32_t)d << 16) + \
			((uint16_t)h << 11) + ((uint16_t)min << 5) + s;
	
	return (tm);
}

